package iet.jxufe.cn.android.productanti_counterfeitingtraceabilitysystem.entity;

import java.util.Arrays;

/**
 * 用来存放产品回溯信息的类，
 * 所有照片需要先转换为byte[]数组再传回
 * @see iet.jxufe.cn.android.productanti_counterfeitingtraceabilitysystem.util.ImageUtils
 */
public class Trace {
    private Integer traceId;    //追溯编号
    private String productId;  //产品编号
    private Integer producerId; //生产商编号
    private byte[] producerImg; //生产者照片
    private Integer dealerId;   //经销商编号
    private byte[] dealerImg; //经销商照片
    private Integer consumerId; //消费者编号
    private byte[] consumerImg; //消费者照片

    public Trace(String productId, Integer producerId, byte[] producerImg) {
        this.productId = productId;
        this.producerId = producerId;
        this.producerImg = producerImg;
    }

    public Trace(Integer consumerId, byte[] consumerImg, Integer dealerId, byte[] dealerImg, Integer producerId, byte[] producerImg, String productId, Integer traceId) {
        this.consumerId = consumerId;
        this.consumerImg = consumerImg;
        this.dealerId = dealerId;
        this.dealerImg = dealerImg;
        this.producerId = producerId;
        this.producerImg = producerImg;
        this.productId = productId;
        this.traceId = traceId;
    }

    public Trace() {}

    public Integer getTraceId() {
        return traceId;
    }

    public void setTraceId(Integer traceId) {
        this.traceId = traceId;
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public Integer getProducerId() {
        return producerId;
    }

    public void setProducerId(Integer producerId) {
        this.producerId = producerId;
    }

    public byte[] getProducerImg() {
        return producerImg;
    }

    public void setProducerImg(byte[] producerImg) {
        this.producerImg = producerImg;
    }

    public Integer getDealerId() {
        return dealerId;
    }

    public void setDealerId(Integer dealerId) {
        this.dealerId = dealerId;
    }

    public byte[] getDealerImg() {
        return dealerImg;
    }

    public void setDealerImg(byte[] dealerImg) {
        this.dealerImg = dealerImg;
    }

    public Integer getConsumerId() {
        return consumerId;
    }

    public void setConsumerId(Integer consumerId) {
        this.consumerId = consumerId;
    }

    public byte[] getConsumerImg() {
        return consumerImg;
    }

    public void setConsumerImg(byte[] consumerImg) {
        this.consumerImg = consumerImg;
    }

    @Override
    public String toString() {
        return "Trace{" +
                "consumerId=" + consumerId +
                ", traceId=" + traceId +
                ", productId=" + productId +
                ", producerId=" + producerId +
                ", producerImg=" + Arrays.toString(producerImg) +
                ", dealerId=" + dealerId +
                ", dealerIdImg=" + Arrays.toString(dealerImg) +
                ", consumerImg=" + Arrays.toString(consumerImg) +
                '}';
    }
}
